package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReturnsTheNumberOfElementsSharedBetweenTheTwoArraysContainingSets {
	public static void main(String[] argv) {
		int[] arra = new int[]{34, 35, 36, 37, 37, 37, 67, 68, 69};
		int[] arrb = new int[]{34, 35, 36, 37, 37, 37, 67, 68, 69};
		System.out.println(countCommonElements(arra, arrb));
	}

	public static int countCommonElements(int[] arra, int[] arrb) {

		int k = 0;

		for (int i = 0; i < arra.length; i++) {
			for (int j = 0; j < arrb.length; j++) {
				if (arra[i] == arrb[j]) {
					k++;
				}
			}
		}

		return k;
	}
}
